<%@page import="java.util.Calendar"%>
<%@page import="java.util.GregorianCalendar"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
<%
	String str="";
	String selected="";

	Calendar cal = Calendar.getInstance();
	int year = cal.get(Calendar.YEAR);
	int month = cal.get(Calendar.MONTH)+1;
	int date = cal.get(Calendar.DATE);
	int lastday = 31;
	int chkmonth = cal.get(Calendar.MONTH)+1;

	if(request.getParameter("year")!=null){
		year = Integer.parseInt(request.getParameter("year"));
	}
	if(request.getParameter("month")!=null){
		month = Integer.parseInt(request.getParameter("month"));
	}
	
	if(month==2){
		if((year%400)==0 || ((year%4)==0 && (year%100)!=0)){
			lastday = 29;
		} else {
			lastday = 28;
		}
	} else if(month%2==1){
		lastday = 31;
	} else {
		lastday = 30;
	}
	
	for(int i=1; i<=lastday;i++){
		if(month == chkmonth){
			if(date == i){
				selected = " selected=\"selected\"";
			} else {
				selected = " ";
			}
		}
		str += "<option value='"+i+"'"+selected+">"+i+"</option>";
	}
%>
</head>
<body>
<%=str%>
</body>
</html>